﻿/***********************************************************************
 * <copyright file="ResourceHelper.cs" company="B/S JSC">
 * -->    Copyright (C) statement. All right reserved
 * </copyright>
 * 
 * Created:   Hoang Bich Son 
 * Email:    sonhb@newman.vn
 * Website:
 * Create Date: Tuesday, April 1, 2014
 * Usage: 
 * 
 * RevisionHistory: 
 * Date         Author               Description 
 * 
 * ************************************************************************/

using System.Resources;

namespace NmResources
{
    /// <summary>
    /// ResourceHelper class
    /// </summary>
    public static class ResourceHelper
    {
        /// <summary>
        /// Gets the admin resource.
        /// </summary>
        /// <param name="resourceName">Name of the resource.</param>
        /// <returns></returns>
        public static string GetAdminResource(string resourceName)
        {
            var resource = new ResourceManager(typeof(AdminResource));
            return resource.GetString(resourceName);
        }

        /// <summary>
        /// Gets the admin error resource.
        /// </summary>
        /// <param name="resourceName">Name of the resource.</param>
        /// <returns></returns>
        public static string MapperResource(this string resourceName)
        {
            if (resourceName == null) return null;
            var resource = new ResourceManager(typeof(MessageResource));
            return resource.GetString(resourceName) ?? resource.GetString("Exception");
        }
    }
}
